import os.path
import tempfile

from django.conf import settings
from django.core.files.uploadedfile import *


def run():
    f = open(r'E:\project\django_core_code\books\scripts\core\img.png', 'rb')
    name = f.name
    _, ext = os.path.splitext(name)
    print(ext)
    content = f.read()
    tp = tempfile.NamedTemporaryFile(suffix='.upload.txt', dir=settings.FILE_UPLOAD_TEMP_DIR)
    print(settings.FILE_UPLOAD_TEMP_DIR)
    print(tp.name)
    f.close()
